package com.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.ParkingcarMapper;
import com.pojo.Parkingcar;
import com.service.ParkingCarService;
import com.vo.ParkingCarSelectVo;
import com.vo.ParkingCarVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ParkingCarServiceimpl implements ParkingCarService {
    @Resource
    private ParkingcarMapper parkingcarMapper;

    @Override
    public int insertall(ParkingCarVo parkingCarVo) {
        int insertall = parkingcarMapper.insertall(parkingCarVo);
        return insertall;
    }

    @Override
    public PageInfo<Parkingcar> selectall(ParkingCarSelectVo parkingCarSelectVo) {
        PageHelper.startPage(parkingCarSelectVo.getPage(),parkingCarSelectVo.getLimit());
        List<Parkingcar> selectall = parkingcarMapper.selectall(parkingCarSelectVo);
        PageInfo<Parkingcar> pageInfo=new PageInfo<>(selectall);
        return pageInfo;
    }

    @Override
    public int updateCarmoneyById(Integer carmoney, Integer id) {
        int id1 = parkingcarMapper.updateCarmoneyById(carmoney, id);
        return id1;
    }

    @Override
    public int selectCarmoneyByIdInt(Integer id) {
        int i = parkingcarMapper.selectCarmoneyByIdInt(id);
        return i;
    }
    @Override
    public List<Parkingcar> selectParkingCarByOwnerId(Integer ownerId) {
        List<Parkingcar> parkingcars = parkingcarMapper.selectParkingcarByOwnerid(ownerId);
        return parkingcars;
    }

    @Override
    public int updateParkinglotStateById(Integer id) {
        int i = parkingcarMapper.updateParkingCarStateById(id);
        return i;
    }

    @Override
    public int updateParkingLotStateByTwo(ParkingCarVo parkingCarVo) {
        int i = parkingcarMapper.updateParkingLotStateByTwo(parkingCarVo);
        return i;
    }

    @Override
    public List<Parkingcar> selectalls() {
        List<Parkingcar> selectalls = parkingcarMapper.selectalls();
        return selectalls;
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        int i = parkingcarMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public Parkingcar selectByPrimaryKey(Integer id) {
        Parkingcar parkingcar = parkingcarMapper.selectByid(id);
        return parkingcar;
    }

    @Override
    public Parkingcar selectByparking(Integer id) {
        Parkingcar parkingcar = parkingcarMapper.selectByparking(id);
        return parkingcar;
    }
}
